VERSION 5.00
Begin VB.Form frmValueSearch 
   BorderStyle     =   1  'Fixed Single
   Caption         =   "value search"
   ClientHeight    =   3315
   ClientLeft      =   45
   ClientTop       =   435
   ClientWidth     =   6000
   BeginProperty Font 
      Name            =   "Tahoma"
      Size            =   8.25
      Charset         =   0
      Weight          =   400
      Underline       =   0   'False
      Italic          =   0   'False
      Strikethrough   =   0   'False
   EndProperty
   Icon            =   "frmValueSearch.frx":0000
   LinkTopic       =   "Form1"
   LockControls    =   -1  'True
   MaxButton       =   0   'False
   ScaleHeight     =   3315
   ScaleWidth      =   6000
   StartUpPosition =   3  'Windows Default
   Begin VB.Frame Frame1 
      Caption         =   "search [value]"
      Height          =   3105
      Left            =   90
      TabIndex        =   4
      Top             =   120
      Width           =   5805
      Begin VB.Frame Frame2 
         Caption         =   "results [address]"
         Height          =   1815
         Left            =   120
         TabIndex        =   5
         Top             =   1170
         Width           =   5565
         Begin VB.ListBox List1 
            Height          =   1425
            Left            =   120
            TabIndex        =   3
            Top             =   270
            Width           =   5325
         End
      End
      Begin VB.OptionButton Option2 
         Caption         =   "decimal"
         Height          =   195
         Left            =   120
         TabIndex        =   2
         Top             =   900
         Width           =   1335
      End
      Begin VB.OptionButton Option1 
         Caption         =   "hexidecimal"
         Height          =   195
         Left            =   120
         TabIndex        =   1
         Top             =   630
         Width           =   1335
      End
      Begin VB.TextBox Text1 
         Height          =   285
         Left            =   120
         TabIndex        =   0
         Top             =   270
         Width           =   1785
      End
   End
End
Attribute VB_Name = "frmValueSearch"
Attribute VB_GlobalNameSpace = False
Attribute VB_Creatable = False
Attribute VB_PredeclaredId = True
Attribute VB_Exposed = False

Private Sub Form_Load()

  Frame1.left = Me.ScaleWidth / 2 - Frame1.Width / 2 'centers frame horizontally
  Frame1.top = Me.ScaleHeight / 2 - Frame1.Height / 2 'centers frame vertically

  Option1.value = True 'sets hexidecimal searching

End Sub


Private Sub List1_DblClick()

  Dim a As Long, b As Long

  frmMemoryEditor.VScroll1.value = 0 'go to beginning

  Call frmMemoryEditor.VScroll1_Change 'update

  b& = CLng("&H" & Replace(List1.Text, "$", "")) - 49152 'get bookmark addy

  For a = 0 To frmMemoryEditor.VScroll1.Max Step 16 'sort through ram by 16 at a time
    frmMemoryEditor.VScroll1.value = a 'assign value
    If a + 256 >= b& Then 'check if near the value
      Call frmMemoryEditor.VScroll1_Change 'update the memory viewer
      Exit For 'stop sorting
    End If
  Next a

End Sub

Private Sub List1_MouseUp(Button As Integer, Shift As Integer, x As Single, Y As Single)

  If Button = 2 Then 'check for right click
    Call PopupMenu(frmSMS.mnuResults) 'pop up menu from main window
  End If

End Sub


Private Sub Text1_KeyPress(KeyAscii As Integer)

  On Error Resume Next

  Dim a As Integer, b As Long, switchy As Integer, d As String

  Select Case KeyAscii
    Case vbKeyReturn 'checks for enter key
      Call List1.Clear 'clears the list of address
      d$ = Replace(Text1.Text, "$", "") 'get value/strip $
      If Option1.value = True Then 'checks to see if hex/dec
        a% = CInt("&H" & d$) 'hex
      Else
        a% = CInt(d$) 'dec
      End If
      For b& = 0 To UBound(cartRam) - 1 'cycles through ram
        If CInt(cartRam(b&)) = a% Then Call List1.AddItem("$" & fixaddress$(Hex(b& + 49152))) 'checks if the value matches/adds address to list if a match
      Next b&
  End Select

End Sub
